<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户意见处理页面</title>
</head>

<body>
<?php
/*---------------------一、PHP文件引用----------------------------------*/
require_once 'response.php';
require_once 'connect_config.php';

/*---------------------二、变量参数定义-------------------------------*/
	$email = $_GET['email'];
	$type = $_GET['type'];
	$suggestion = $_GET['suggestion'];
	$data = array();
	if(!$type || !$email)
	{
		$url = "suggestion.php";
		echo "<script language='javascript' type = 'text/javascript'>";
		echo "alert('邮箱和类型不能为空！');location.href = '$url'";
		echo"</script>";	
	}
	else
	{
		/*---------------------三、数据库连接----------------------------*/
		$conn = mysqli_connect(DB_HOST,DB_USER,DB_PWD,DB_NAME,DB_PORT) or die('数据库连接失败');
		 $query = "insert into mdl_suggestion (type,email,suggestion) values ('$type','$emial','$suggestion')";
         $data = mysqli_query($conn, $query);           
         $row = mysqli_fetch_array($data);
		 $msg = mysqli_errno($conn);
		 if($msg == 0)
		 {
			 $status = true;
             $msg = 'success';
             echo Response::json($status,$msg,$data); 
		 }
		 else
		 {
			 $status = false;
             echo Response::json($status,$msg,$data); 
		 }
	}

?>
</body>
</html>